<?php
/**
 * @package		Joomla.Site
 * @subpackage	mod_articles_latest
 * @copyright	Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

// no direct access
defined('_JEXEC') or die;
$app = & JFactory::getApplication();
$templatepath = JURI::base() . 'templates/' . $app->getTemplate();
?>
<?php if($module->showtitle): ?>
<div class="module-title">
	<h2 class="title"><?php echo $module->title ;?></h2>
</div>
<?php endif; ?>
<div class="k2ItemsBlock latest_news" id="k2ModuleBox121">
<ul>
	<?php $i=0; ?>
	<?php foreach ($list as $item) :  ?>
	<?php //var_dump($item);die; ?>
	<li class="<?php echo ($i%2==0)?'even':'odd'; ?>">
		<?php
			$images = json_decode($item->images);
			if (isset($images->image_intro) and is_file($images->image_intro)) :
		?>
		<a title="<?php echo $item->title; ?>" href="<?php echo $item->link; ?>" class="moduleItemImage">
			<img alt="<?php echo $item->title; ?>" src="timthumb.php?src=<?php echo $images->image_intro; ?>">
		</a>
		<?php endif; ?>	
		<a href="<?php echo $item->link; ?>" class="moduleItemDateCreated"><?php echo JHtml::_('string.truncate', ($item->title), 30); ?><?php //echo JHtml::_('date', $item->created, JText::_('DATE_FORMAT_LC2')); ?> </a>
		<div class="moduleItemIntrotext">
			<?php echo JHtml::_('string.truncate', ($item->introtext), 120); ?>
		</div>
		<div class="clr"></div>
		<div class="clr"></div>
		<div class="clr"></div>
	</li>
	<?php $i=0; ?>
	<?php endforeach; ?>
</ul>
<?php if(!empty($list)): ?>
	<a title="more" href="<?php echo JRoute::_(ContentHelperRoute::getCategoryRoute($item->catid)); ?>" class="moduleCustomLink">more</a>
<?php endif; ?>	
</div>


<?php return; ?>
<ul class="latestnews<?php echo $moduleclass_sfx; ?>">
<?php foreach ($list as $item) :  ?>
	<li>
		<a href="<?php echo $item->link; ?>">
			<?php echo $item->title; ?></a>
	</li>
<?php endforeach; ?>
</ul>
